{% extends "base.html" %} {% block title %}图书详情{% endblock %} {% block
content %}
<div class="page">
  <div class="page__hd">
    <h1 class="page__title">图书详情</h1>
    <p class="page__desc">可分享、可删除</p>
  </div>
  <div class="page__bd">
    <div
      role="alert"
      id="js_current_tips"
      style="display: block"
      class="weui-cells__tips weui-cells__tips_warn"
    >
      {{err}}
    </div>
    <div class="weui-form-preview">
      <div role="option" class="weui-form-preview__hd">
        <label class="weui-form-preview__label">图书名称</label>
        <em class="weui-form-preview__value">{{name}}</em>
      </div>
      <div
        role="option"
        aria-labelledby="p4 js_a11y_comma p5 js_a11y_comma p6"
        class="weui-form-preview__bd"
      >
        <div id="p5" class="weui-form-preview__item">
          <label class="weui-form-preview__label">出版社</label>
          <span class="weui-form-preview__value">{{press}}</span>
        </div>
        <div id="p6" class="weui-form-preview__item">
          <label class="weui-form-preview__label">ISBN</label>
          <span class="weui-form-preview__value">{{isbn}}</span>
        </div>
      </div>
      <div class="weui-form-preview__ft"></div>

      {% if status == 1 %}
      <a
        role="button"
        class="weui-form-preview__btn weui-form-preview__btn_primary"
        href="/chatbook/{{username}}"
        >留言</a
      >
      {% else if status == 2 %}
      
      <form action="/delbook/{{id}}" method="post">
        <div class="button-sp-area">
          <button
            id="delbook"
            type="submit"
            role="button"
            class="weui-btn weui-btn_mini weui-btn_primary weui-wa-hotarea"
          >
            删除
          </button>
        </div>
      </form>

      {% else %}

      <form action="/delbook/{{id}}" method="post">
        <div class="button-sp-area">
          <button
            id="delbook"
            type="submit"
            role="button"
            class="weui-btn weui-btn_mini weui-btn_default weui-wa-hotarea"
          >
            删除
          </button>
        </div>
      </form>
      <form action="/sharebook/{{id}}" method="post">
        <div class="button-sp-area">
          <button
            id="sharebook"
            type="submit"
            role="button"
            class="weui-btn weui-btn_mini weui-btn_primary weui-wa-hotarea"
          >
            分享
          </button>
        </div>
      </form>

      {% endif %}
    </div>
  </div>
</div>

<script type="text/javascript">
  // $(function () {
  //   var $sharebook = $("#sharebook"),
  //     $delbook = $("#delbook");

  //   $sharebook.on("click", function (e) {
  //     $.post("/sharebook/{{id}}");
  //     // e.preventDefault();
  //   });
  //   $delbook.on("click", function (e) {
  //     $.post("/delbook/{{id}}");
  //     // e.preventDefault();
  //   });
  // });
</script>
{% endblock %}
